/**
 * @Author : SL
 * @Date : 2019/5/29
 * @Version :1.0
 * @Last Modified by : SL
 * @Last Modified time : 2019/5/29
 **/
const http = require('http')

const server = http.createServer((req, res) => {
    if (req.method === "POST") {
        //数据格式
        console.log('content-type', req.headers['content-type'])
        //接收数据
        let postData = ""
        req.on('data', chunk => {
            postData += chunk.toString()
        })
        req.on('end', () => {
            console.log(postData)
            res.end('hello World')  //在这里返回因为是异步
        })
    }
})

server.listen(8000)
console.log("OK")